package com.dqyt.khjc.controller;

import com.dqyt.khjc.bean.ResultMsg;
import com.dqyt.khjc.service.LocaGzlqrdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 本地的工作量确认单
 */
@RestController
public class LocaGzlqrdController {


    @Autowired
    private LocaGzlqrdService locaGzlqrdService;

    /**
     * 新增样品信息
     * @param request
     * @param locaGzlqrd
     * @return
     */
    @RequestMapping(value = "/api/saveLocaGzlqrd", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcSample(HttpServletRequest request, String locaGzlqrd,String rwdbh){
        ResultMsg resultMsg =locaGzlqrdService.saveLocaGzlqrd(request,locaGzlqrd, rwdbh);
        return resultMsg;
    }




    /**
     * 分页查询本地工作量确认单
     * @param request
     * @param page
     * @param size
     * @param rwdbh
     * @param wtfId
     * @return
     */
    @RequestMapping(value = "/api/getLocaGzlqrdPage", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg getLocaGzlqrdPage(HttpServletRequest request,
                                        @RequestParam(defaultValue = "1") Integer page,
                                        @RequestParam(defaultValue = "10") Integer size,
                                        @RequestParam(name = "rwdbh", required = false, defaultValue = "") String rwdbh,
                                        @RequestParam(defaultValue = "0") Integer wtfId,
                                        @RequestParam(defaultValue = "0") Integer wtfchId,
                                        @RequestParam(defaultValue = "0") Integer start
    ){
        ResultMsg resultMsg = locaGzlqrdService.getLocaGzlqrdPage(request,page,size,rwdbh,wtfId,wtfchId,start);
        return resultMsg;
    }



    /**
     * 分页查询本地工作量确认单  待批准的
     * @param request
     * @param page
     * @param size
     * @param rwdbh
     * @param wtfId
     * @return
     */
    @RequestMapping(value = "/api/getLocaGzlqrdDpzPage", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg getLocaGzlqrdDpzPage(HttpServletRequest request,
                                       @RequestParam(defaultValue = "1") Integer page,
                                       @RequestParam(defaultValue = "10") Integer size,
                                       @RequestParam(name = "rwdbh", required = false, defaultValue = "") String rwdbh,
                                       @RequestParam(defaultValue = "0") Integer wtfId,
                                       @RequestParam(defaultValue = "0") Integer wtfchId
    ){
        ResultMsg resultMsg = locaGzlqrdService.getLocaGzlqrdDpzPage(request,page,size,rwdbh,wtfId,wtfchId);
        return resultMsg;
    }




    /**
     * 设置 驳回工作量确认单
     * @param request
     * @param bhgyy
     * @return
     */
    @RequestMapping(value = "/api/rejectQrdDal2", method = {RequestMethod.POST})
    public  ResultMsg rejectQrdDal2(HttpServletRequest request,String bhgyy,String rwdbh){
        ResultMsg resultMsg = locaGzlqrdService.rejectQrdDal2(request,bhgyy,rwdbh);
        return resultMsg;
    }


    /**
     * 设置 通过 通工作量确认单
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/srtQrdOkProgress2", method = {RequestMethod.POST})
    public  ResultMsg srtQrdOkProgress(HttpServletRequest request,String rwdbh){
        ResultMsg resultMsg = locaGzlqrdService.srtQrdOkProgress2(request,rwdbh);
        return resultMsg;
    }


    /**
     * 新增样品信息
     * @param request
     * @param locaGzlqrd
     * @return
     */
    @RequestMapping(value = "/api/upLocaGzlqrd", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg upLocaGzlqrd(HttpServletRequest request, String locaGzlqrd){
        ResultMsg resultMsg =locaGzlqrdService.upLocaGzlqrd(request,locaGzlqrd);
        return resultMsg;
    }


    /**
     * 分配任务
     * @return
     */
    @RequestMapping(value = "/api/deleteLocaGzlqrd")
    public ResultMsg deleteLocaGzlqrd(HttpServletRequest request,String rwdbh){
        ResultMsg resultMsg = locaGzlqrdService.deleteLocaGzlqrd(request, rwdbh);
        return resultMsg;
    }




    /**
     * 分页查询本地工作量确认单
     * @param request
     * @param rwdbh
     * @param wtfId
     * @return
     */
    @RequestMapping(value = "/api/getLocaGzlqrdTj", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg getLocaGzlqrdTj(HttpServletRequest request,
                                       @RequestParam(name = "rwdbh", required = false, defaultValue = "") String rwdbh,
                                       @RequestParam(defaultValue = "0") Integer wtfId,
                                       @RequestParam(defaultValue = "0") Integer wtfchId,
                                       @RequestParam(defaultValue = "0") Integer start
    ){
        ResultMsg resultMsg = locaGzlqrdService.getLocaGzlqrdTj(request,rwdbh,wtfId,wtfchId,start);
        return resultMsg;
    }


}
